package day15.tarena.homework;
public class Person {
		private int age;
		private String name;
		
		public Person(int age, String name)  throws AgeException{
				super();
				this.setAge(age);
				this.setName(name);
		}
	
		public int getAge() {
				return age;
		}
	
		public void setAge(int age) throws AgeException {
			if(age>0 && age<130){
				this.age = age;
			}else{
				throw new AgeException("年龄不合法");
			}
		}
		public String getName() {
				return name;
		}
	
		public void setName(String name) {
				this.name = name;
		}
		
		public String toString(){
			return age+":"+name;
		}
		public static void main(String[] args) {
				Person p = null;
				try {
						 p = new Person(25, "wang");
				}catch (AgeException e){
						e.printStackTrace();
						System.out.println("就地解决");
				}
				System.out.println(p);

		}
		
		
}
